package com.huluobo.mvvm.db.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.huluobo.mvvm.db.eneity.Money;

import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Observable;

/**
 * Created by LC on 2023/9/16.
 */
@Dao
public interface MoneyDao {
    //插入
    //onConflict 设置冲突策略,(REPLACE -替换,ABORT - 回滚,IGNORE-忽略)
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Completable insertUserMonty(Money money);

    //删除
    @Delete
    Completable deleteUserMoney(Money money);

    //更新
    @Update
    Completable updateUserMoney(Money money);

    @Query("select * from user_money where user_name =:username")
    Observable<Money> queryUserMoney(String username);
}
